import request from '@/utils/request'

/**
 * 触发构建
 * @param {Number} websiteId - 网站ID
 */
export function TriggerBuild(websiteId) {
  return request({
    url: `/static_web/api/build/${websiteId}/trigger/`,
    method: 'post'
  })
}

/**
 * 获取构建状态
 * @param {Number} websiteId - 网站ID
 */
export function GetBuildStatus(websiteId) {
  return request({
    url: `/static_web/api/build/${websiteId}/status/`,
    method: 'get'
  })
}

/**
 * 获取构建历史
 * @param {Number} websiteId - 网站ID
 * @param {String} args - 查询参数
 */
export function GetBuildHistory(websiteId, args) {
  return request({
    url: `/static_web/api/build/${websiteId}/history/${args && ('?' + args) || ''}`,
    method: 'get'
  })
}

/**
 * 获取构建日志
 * @param {Number} buildId - 构建记录ID
 */
export function GetBuildLog(buildId) {
  return request({
    url: `/static_web/api/build/${buildId}/log/`,
    method: 'get'
  })
}
